package com.le.tester.onjava8.l1_11_1;

import com.le.tester.javaThink.fourth.enumerated.Competitor;
import com.le.tester.javaThink.fourth.enumerated.Outcome;
import com.le.tester.javaThink.fourth.enumerated.RoShamBo;

import static com.le.tester.javaThink.fourth.enumerated.Outcome.*;


/**
 * createTime：2022/10/28 14:27
 * description：
 */
public enum RoShamBo2 implements Competitor<RoShamBo2> {
    PAPER(DRAW, LOSE, WIN),
    SCISSORS(WIN, DRAW, LOSE),
    ROCK(LOSE, WIN, DRAW);

    private Outcome vPAPER, vSCISSORS, vROCK;

    RoShamBo2(Outcome vPAPER, Outcome vSCISSORS, Outcome vROCK) {
        this.vPAPER = vPAPER;
        this.vSCISSORS = vSCISSORS;
        this.vROCK = vROCK;
    }

    @Override
    public Outcome compete(RoShamBo2 competitor) {
        switch (competitor) {
            default:
            case PAPER:
                return vPAPER;
            case ROCK:
                return vROCK;
            case SCISSORS:
                return vSCISSORS;
        }
    }

    public static void main(String[] args) {
        RoShamBo.play(RoShamBo2.class, 20);
    }
}
